<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //1. 数组的flat flatMap方法：将扁平化数组拉伸为一维数组，在之前讲过，这里略过
        //2. Symbol对象的description属性
        let s = Symbol("twj")
        console.log(s.description) // twj
        //3. 可选的catch，catch后面的参数可省略
        let pro1 = new Promise(function (resolve, reject) {
            //执行器函数
            setTimeout(() => {
                resolve(2000)
            }, 4000)
        })
        let pro2 = new Promise(function (resolve, reject) {
            //执行器函数
            setTimeout(() => {
                reject(2000)
            }, 2000)
        })
        async function test() {
            try {
                await Promise.race([pro1, pro2])
            } catch {
                console.log("超时")
            }
        }
        test()
    </script>
</body>

</html>